// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: jing

#pragma once
#include <experimental/filesystem>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>

#include "coin2/exchange/base/market/market_exchange_api.h"
#include "coin2/flow/symbol_group.h"

namespace coin2::exchange::base::feed::arbitration {
namespace impl {

struct ArbitrationConfig {
  int64_t window_size;
  std::map<char, int64_t> group_window_sizes;
};

class ArbitrationConfigMap {
 public:
  explicit ArbitrationConfigMap(
      const coin2::flow::SymbolGroupConfig& symbol_groups,
      const std::experimental::filesystem::path& path = "data/coin2/feed/arbitration.toml");

  int64_t GetWindowSize(const MarketExchangeApi& mea, char group) const;
  int64_t GetWindowSize(const MarketExchangeApi& mea) const;

 private:
  std::unordered_map<MarketExchangeApi, ArbitrationConfig> configs_;
};

}  // namespace impl
}  // namespace coin2::exchange::base::feed::arbitration
